/*
 * AbstractStyle.java  0.4.0 / Oct 25, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing.styles;

import com.cute4j.swing.Style;

/**
 * Abstract Style.
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public abstract class AbstractStyle extends Style { // NOPMD - abstract class

// Private Fields. -------------------------------------------------------------

  private final String name;
  private final String description;
  private final Theme theme;
  private int hashCode; // NOPMD

// Protected Constructors. -----------------------------------------------------

  /**
   * Abstract Style.
   *
   * @param name the name
   * @param description the description
   * @param theme the theme
   *
   * @throws IllegalArgumentException if the name is <tt>null</tt>
   */
  protected AbstractStyle(String name, String description, Theme theme) {
    if (name == null) {
      throw new IllegalArgumentException("Null name");
    }
    this.name = name;
    this.description = description;
    this.theme = theme;
  }

// Overridden Methods. ---------------------------------------------------------

  /**
   * {@inheritDoc}
   */
  public int hashCode() { // NOPMD
    if (hashCode == 0) {
      hashCode = super.hashCode();
    }
    return hashCode; // NOFB
  }

  /**
   * {@inheritDoc}
   */
  public String getName() {
    return name;
  }

  /**
   * {@inheritDoc}
   */
  public String getDescription() {
    return description;
  }

  /**
   * {@inheritDoc}
   */
  public Theme getTheme() {
    return theme;
  }

}
